﻿@model TidyBlog.Entity.Link[]

@{
	ViewBag.Title = "链接管理";
	Layout = "~/Views/Shared/_ManageLayout.cshtml";
}

<table class="alignCenter">
	<thead>
		<tr>
			<th style="width: 7%;">编号</th>
			<th style="width: 17%;">站名</th>
			<th style="width: 30%;">地址</th>
			<th style="width: 10%">权重</th>
			<th style="width: 22%;">描述</th>
			<th style="width: 14%;">操作</th>
		</tr>
	</thead>
	<tbody>
@if (Model == null || Model.Length <= 0)
{
		<tr>
			<td colspan="6">暂无友情链接</td>
		</tr>
}
else
{
	foreach (var link in Model)
	{
		var routeValues = new { id = link.LinkId };
		<tr>
			<td>@link.LinkId</td>
			<td><a href="@link.LinkUrl" target="_blank">@link.LinkName</a></td>
			<td>@link.LinkUrl</td>
			<td>@link.Weight</td>
			<td>@link.Description</td>
			<td style="text-align: center;">
				<a href="@Url.Action("Edit", routeValues)">编辑</a>　
				<a href="@Url.Action("Delete", routeValues)" class="delete-confirm">删除</a>
			</td>
		</tr>
	}
}
	</tbody>
</table>

@section Script{
<script>
require('dom/1.0.x/', function($) {
	$('a.delete-confirm').click(function(e) {
		if ( !window.confirm('确认要删除此链接吗（此操作不可恢复）？') ) {
			e.preventDefault();
		}
	});
});
</script>
}